package com.pointstar.dp.modules.project.controller;

import com.pointstar.dp.common.annotation.SysLog;
import com.pointstar.dp.common.entity.Page;
import com.pointstar.dp.common.entity.R;
import com.pointstar.dp.modules.project.entity.InBoundDetailsEntity;
import com.pointstar.dp.modules.project.service.InBoundDetailsService;
import com.pointstar.dp.modules.sys.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 入库明细表
 * @author Korey<m13057531285@163.com>
 */
@RestController
@RequestMapping("/inboundDetails")
public class InBoundDetailsController extends AbstractController {
	
	private final InBoundDetailsService inBoundDetailsService;

	@Autowired
	public InBoundDetailsController(InBoundDetailsService inBoundDetailsService) {
		this.inBoundDetailsService = inBoundDetailsService;
	}

	/**
	 * 分页列表
	 * @param params
	 * @return
	 */
	@PostMapping("/inList")
	public Page<InBoundDetailsEntity> inList(@RequestBody Map<String, Object> params) {
		return inBoundDetailsService.listInBoundDetails(params);
	}

	/**
	 * 列表
	 * @return
	 */
	@PostMapping("/inListNoPage")
	public List<InBoundDetailsEntity> inListNoPage(@RequestBody Map<String, Object> params) {
		return inBoundDetailsService.listInBoundDetailsNoPage(params);
	}

	/**
	 * 分页列表
	 * @param params
	 * @return
	 */
	@PostMapping("/list")
	public Page<InBoundDetailsEntity> list(@RequestBody Map<String, Object> params) {
		return inBoundDetailsService.listBoundDetails(params);
	}

	/**
	 * 列表
	 * @return
	 */
	@PostMapping("/listNoPage")
	public List<InBoundDetailsEntity> listNoPage(@RequestBody Map<String, Object> params) {
		return inBoundDetailsService.listBoundDetailsNoPage(params);
	}


	/**
	 * 新增
	 * @param inBoundDetails
	 * @return
	 */
	@SysLog("新增入库明细表")
	@PostMapping("/save")
	public R save(@RequestBody InBoundDetailsEntity inBoundDetails) {
		return inBoundDetailsService.saveInBoundDetails(inBoundDetails);
	}
	
	/**
	 * 根据id查询详情
	 * @param id
	 * @return
	 */
	@SysLog("显示入库明细表")
	@PostMapping("/info")
	public R getById(@RequestBody Long id) {
		return inBoundDetailsService.getInBoundDetailsById(id);
	}

	/**
	 * 修改
	 * @param inBoundDetails
	 * @return
	 */
	@SysLog("修改入库明细表")
	@PostMapping("/update")
	public R update(@RequestBody InBoundDetailsEntity inBoundDetails) {
		return inBoundDetailsService.updateInBoundDetails(inBoundDetails);
	}
	
	/**
	 * 删除
	 * @param id
	 * @return
	 */
	@SysLog("删除入库明细表")
	@PostMapping("/remove")
	public R batchRemove(@RequestBody Long[] id) {
		return inBoundDetailsService.batchRemove(id);
	}
	
}
